package com.orange.notificationsummary;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class EventTypeAndCount implements Comparable<EventTypeAndCount> {
	private long		mLastEventTime;
	private Drawable	mEvent_icon;
	public int			event_count;
	private Context		mContext;

	@Override
	public int compareTo(EventTypeAndCount another) {
		long time = another.mLastEventTime;
		if (time > mLastEventTime) {
			return 1;
		} else if (time < mLastEventTime) {
			return -1;
		} else {
			return 0;
		}
	}

	public EventTypeAndCount(long lastEventTime, Drawable event_icon,
			int event_count, Context context) {
		this.mLastEventTime = lastEventTime;
		this.mEvent_icon = event_icon;
		this.event_count = event_count;
		this.mContext = context;
	}

	public View getEventView() {
		LayoutInflater flater = LayoutInflater.from(mContext);
		View v = flater.inflate(R.layout.top_events_layout, null);
		ImageView iv = (ImageView) v.findViewById(R.id.event_type);
		iv.setImageDrawable(mEvent_icon);
		TextView tv = (TextView) v.findViewById(R.id.event_count);
		tv.setText(String.valueOf(event_count));
		return v;
	}
}
